package com.hbvtc.xxxy.nikeSale.frames;
/*
 * 查询员工的信息
 */
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Vector;

import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;

import com.hbvtc.xxxy.nikeSale.utils.DbManager;

public class SelectSalesmanNike extends JFrame{
	Vector row ,column;
	JTable jTable=null;
	JScrollPane jsp=null;
	PreparedStatement pst=null;
	Connection conn=null;
	ResultSet res=null;
	String sql;
	public SelectSalesmanNike(){
			this.setTitle("所有员工信息界面");
			this.setSize(1000,700);
			this.setLocationRelativeTo(null);
			this.setVisible(true);	
			column=new Vector();	
			column.add("员工编号");
			column.add("员工姓名");
			column.add("员工电话");
			column.add("员工性别");
			column.add("员工薪水");
			column.add("员工级别");
			row=new Vector();
			conn=DbManager.getconn();
			sql="select SalesmanId,SalesmanName,Mobile,Gender,BaseSalary,Role from salesman";
			try {
				pst=conn.prepareStatement(sql);
				res=pst.executeQuery();
				while (res.next()) {
					Vector vector=new Vector();
					vector.add(res.getInt(1));
					vector.add(res.getString(2));
					vector.add(res.getString(3));
					vector.add(res.getString(4));
					vector.add(res.getDouble(5));
					vector.add(res.getString(6));
					row.add(vector);
				}
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
			jTable =new JTable(row,column);
			jsp=new JScrollPane(jTable);
			this.add(jsp);
			this.setSize(1000,700);
			this.setLocationRelativeTo(null);
			this.setVisible(true);
		}
	public static void main(String[] args) {
		new SelectSalesmanNike().setVisible(true);
	}
}
